﻿using System;
using System.Collections.Generic;

namespace Game
{
    public class PlayerConfigEntity : ConfigEntity
    {
        private Dictionary<int, PlayerConfigData> _id2dataDict = new Dictionary<int, PlayerConfigData>();
        
        public PlayerConfigEntity() : base("Assets/Game/Assets/Config/Player/players.json")
        {
        }

        public PlayerConfigData GetData(int id)
        {
            return _id2dataDict[id];
        }
        
        protected override void InitConfig()
        {
            foreach (string id in _configJsonObject.Keys)
            {
                PlayerConfigData configData = new PlayerConfigData(Convert.ToInt32(id), _configJsonObject[id]);
                _id2dataDict.Add(configData.id, configData);
            }
        }
    }
}